Skip to content

fix: decouple release asset updated indicators from unread state - #283

Merged
AmintaCCCP merged 2 commits into
mainfrom
fix/release-asset-read-indicators
Aug 20, 2026
Merged

fix: decouple release asset updated indicators from unread state#283
AmintaCCCP merged 2 commits into
mainfrom
fix/release-asset-read-indicators

Conversation

@AmintaCCCP

@AmintaCCCP AmintaCCCP commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the issue where per-asset "资产已更新 / Assets updated" badges disappeared as soon as a release was marked read (e.g. when expanding its assets), hiding the very updates the user was meant to notice.

Asset-level read state is now independent of release-level unread state:

  • New store action markAssetAsRead(assetId): removes an asset id from a release's updated_asset_ids without touching readReleases/is_read; early-returns when no release contains the asset to avoid redundant re-renders and autoSync pushes.
  • ReleaseCard: the per-asset badge no longer depends on isUnread — it only reflects updated_asset_ids. Clicking an asset (RPC button or plain link) clears only that asset's badge; it no longer propagates to the release-level mark-as-read.
  • ReleaseTimeline: wires onMarkAssetAsRead through both <ReleaseCard> usages.
  • markAllReleasesAsRead: also clears all per-asset badges, and sets is_read: true on touched records so a later autoSync full push cannot overwrite the backend's mark-all-read state with stale is_read: false.

Changes

  • src/store/useAppStore.ts: add markAssetAsRead, update markAllReleasesAsRead
  • src/components/ReleaseCard.tsx: decouple badge from isUnread, add onMarkAssetAsRead prop
  • src/components/ReleaseTimeline.tsx: pass onMarkAssetAsRead
  • src/store/useAppStore.test.ts: extend store action tests
  • src/components/ReleaseCard.test.tsx: new component regression tests

Testing

  • 328 tests pass (5 new ReleaseCard component tests + extended store tests)
  • eslint clean on changed files
  • no new tsc errors (existing 32 pre-existing errors are in unrelated files githubListsApi.ts / autoSync.githubToken.test.ts)

Summary by CodeRabbit

  • New Features

    • Added asset-level read tracking for release updates.
    • Asset indicators now remain visible until the specific asset is opened.
    • Opening a download or asset link marks that asset as read without marking the entire release as read.
    • Marking releases as read clears their asset update indicators.
    • Indicators now reflect explicitly tracked asset updates rather than timestamps.
  • Tests

    • Added coverage for asset-specific read behavior and release read-state handling.

Per-asset 'assets updated' badges were cleared when a release was marked
read (e.g. expanding it), hiding the very updates the user was meant to
notice. Asset-level read state is now independent of release unread state:

- Add markAssetAsRead store action that removes an asset id from a
  release's updated_asset_ids without touching readReleases/is_read
- ReleaseCard badge no longer depends on isUnread; clicking an asset
  clears only that asset's badge
- markAllReleasesAsRead also clears all per-asset badges and sets
  is_read=true on touched records so autoSync pushes cannot overwrite
  the backend's mark-all-read state with stale is_read:false
- Add ReleaseCard component tests and extend store tests
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 75deceed-a168-431a-8764-f653d6c00770

📥 Commits

Reviewing files that changed from the base of the PR and between 8635592 and e4c8467.

📒 Files selected for processing (7)
  • src/components/ReleaseCard.test.tsx
  • src/components/ReleaseCard.tsx
  • src/components/ReleaseTimeline.tsx
  • src/store/useAppStore.test.ts
  • src/store/useAppStore.ts
  • src/utils/releaseAssets.test.ts
  • src/utils/releaseAssets.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change replaces timestamp-based asset indicators with explicit updated_asset_ids tracking. It adds asset-level read actions, clears markers when releases are marked read, and wires the action through both release views.

Changes

Asset update indicator contract

Layer / File(s) Summary
Explicit asset update indicator
src/utils/releaseAssets.ts, src/utils/releaseAssets.test.ts
shouldShowAssetsUpdatedIndicator now returns true only when updated_asset_ids is non-empty. Timestamp-only updates no longer show an indicator.

Store asset read state

Layer / File(s) Summary
Store asset read state
src/store/useAppStore.ts, src/store/useAppStore.test.ts
The store adds markAssetAsRead, clears matching asset IDs, preserves release read state, and clears markers when one or all releases are marked as read.

Release view asset interactions

Layer / File(s) Summary
Release card and timeline integration
src/components/ReleaseCard.tsx, src/components/ReleaseTimeline.tsx, src/components/ReleaseCard.test.tsx
Release cards show indicators independently of release unread state. Asset links and RPC downloads mark identified assets as read. Timeline and repository cards receive the store callback, and repository indicators inspect all releases.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to e4c84

This change separates asset-update indicators from release read state and adds targeted handling for marking assets and releases read. No actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ReleaseCard
  participant ReleaseTimeline
  participant useAppStore
  User->>ReleaseCard: Click an asset link or RPC download
  ReleaseCard->>useAppStore: markAssetAsRead(assetId)
  useAppStore->>useAppStore: Remove assetId from updated_asset_ids
  ReleaseTimeline->>ReleaseCard: Provide markAssetAsRead callback
  useAppStore->>ReleaseCard: Updated release state
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: separating release asset update indicators from release unread state.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-asset-read-indicators

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The container-level "Assets updated" badge was inferred from
asset updated_at > release published_at, which is true for nearly
every GitHub release (assets are uploaded after release creation)
and unrelated to changes since the user's last pull — causing
massive false positives with no matching per-asset badge.

Make updated_asset_ids the single source of truth for both the
container and per-asset indicators, and clear it in
markReleaseAsRead so clicking a release dismisses its badges.
The repository group header now shows the badge when any release
in the group has undismissed asset updates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AmintaCCCP
AmintaCCCP merged commit 90ed7a4 into main Aug 20, 2026
5 checks passed
@AmintaCCCP
AmintaCCCP deleted the fix/release-asset-read-indicators branch August 20, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant